<include file="public:header"/>
<include file="public:sidebar"/>
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            创建二维码
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li class="active">二维码</li>
        </ol>
    </section>
    <!-- Main content -->
    <section class="content">
        <div class="col-md-12">
            <div style="margin: 10px;">
                <button onclick="history.go(-1)" class="layui-btn layui-btn-sm layui-btn-radius layui-btn-danger">
                    <i class="layui-icon">&#xe65c;</i>返回
                </button>
            </div>
            <!-- Horizontal Form -->
            <div class="box box-info"  style="min-height: 450px;">
                <div class="box-header with-border">
                    <h3 class="box-title">生成二维码</h3>
                </div>
                <!-- /.box-header -->
                <!-- form start -->
                <form class="layui-form" action="{:Url('article_qrcode1')}" id="form1" autocomplete="off">
                    <!--<div class="layui-form-item" style="margin-top: 20px;">-->
                        <!--<label class="layui-form-label" style="width:120px;">类型</label>-->
                        <!--<div class="layui-input-block">-->
                            <!--<div class="col-sm-3" style="padding-left: 0;">-->
                                <!--<input type="hidden" name="aid" value="{$info.id}">-->
                                <!--<input type="hidden" name="mc_id" value="{$info.mcid}">-->
                                <!--<select name="type" lay-filter="type">-->
                                    <!--<option value="0">全国</option>-->
                                    <!--<option value="1">省级</option>-->
                                    <!--<option value="2">市级</option>-->
                                    <!--<option value="3">县区</option>-->
                                    <!--<option value="4">镇级</option>-->
                                <!--</select>-->
                            <!--</div>-->
                        <!--</div>-->
                    <!--</div>-->
                    <!--<div class="layui-form-item" style="margin-top: 20px;">-->
                        <!--<label class="layui-form-label" style="width:120px;">区域</label>-->
                        <!--<div class="layui-input-block">-->
                            <!--<div class="col-sm-3 provice" style="padding-left: 0;">-->
                                <!--<select name="pro" lay-filter="pro">-->
                                    <!--<option value=""></option>-->
                                    <!--<volist name="provinces" id="vo">-->
                                        <!--<option value="{$vo.provinceid}_{$vo.province}">{$vo.province}</option>-->
                                    <!--</volist>-->
                                <!--</select>-->
                            <!--</div>-->
                            <!--<div class="col-sm-3 city"></div>-->
                            <!--<div class="col-sm-4 area"></div>-->
                        <!--</div>-->
                    <!--</div>-->
                    <div class="layui-form-item" style="margin-top: 10px;">
                        <label class="layui-form-label" style="width:120px;">活动名称</label>
                        <div class="layui-input-block">
                           <p class="text-danger" style="padding-top: 8px;">{$info.title}</p>
                        </div>
                        <input type="hidden" name="aid" value="{$info.id}">
                    </div>
                    <div class="layui-form-item" style="margin-top: 10px;margin-left: 50px;">
                        <button class="layui-btn layui-btn-sm" lay-submit lay-filter="*">生成二维码</button>
                    </div>
                </form>
            </div>
        </div>
    </section>
    <!-- /.content -->
</div>
<script id="city" type="text/html">
    <select name="city" lay-filter="city">
        <option value="">--请选择市--</option>
        {{#  layui.each(d.data.list, function(index, item){ }}
        <option value="{{item.cityid}}_{{item.city}}">{{item.city}}</option>
        {{#  }); }}
    </select>
</script>
<script id="area" type="text/html">
    <select name="area" lay-filter="area">
        <option value="">--请选择县--</option>
        {{#  layui.each(d.data.list, function(index, item){ }}
        <option value="{{item.areaid}}_{{item.area}}">{{item.area}}</option>
        {{#  }); }}
    </select>
</script>
<script>
    layui.use(['form','layer','laytpl'],function () {
        var form = layui.form,
            layer = layui.layer,
            laytpl = layui.laytpl;
        form.on('select(pro)', function(data){
            var pid = data.value.split('_');
            $.get('{:Url("article/get_city")}',{pid: pid[0]},function (result) {
                var getTpl = city.innerHTML;
                laytpl(getTpl).render(result, function(html){
                    $('.city').empty().html(html);
                    $('.area').empty();
                    form.render()
                });
            })
        });
        form.on('select(city)', function(data){
            var cid = data.value.split('_');
            $.get('{:Url("article/get_areas")}',{cid: cid[0]},function (result) {
                var getTpl = area.innerHTML;
                laytpl(getTpl).render(result, function(html){
                    $('.area').empty().html(html);
                    form.render()
                });
            });
        });
        form.on('submit(*)', function(data){
            var index = layer.load();
            $.post(data.form.action,data.field,function (result) {
                layer.close(index);
                if(result.code){
                    layer.msg(result.msg);
                    return false;
                }
                layer.alert(result.msg,{icon:6,end:function () {
                    history.go(-1);
                }});
            });
            return false;
        });
    });
</script>
<include file="public:footer"/>